Skip to content

fix(doctor): add --gate so a gate-only config needs no model key - #201

Merged
merge-loop[bot] merged 2 commits into
mainfrom
cb/sweep-bugpatrol-199
Nov 16, 2026
Merged

merge-loop[bot] merged 2 commits into
mainfrom
cb/sweep-bugpatrol-199

Conversation

@cjber

@cjber cjber commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

bugpatrol init --gate writes a config for the deterministic web gate (bugpatrol run), then told the user to run bugpatrol doctor. Doctor checked every config for the explorer and judge LLMs with fatal checks, so without OPENROUTER_API_KEY it exited 2, although the gate never calls an agent.

Design: an explicit flag, bugpatrol doctor --gate, rather than inferring intent from the config. A config with a run block can also drive the agents, so the config alone does not say which commands the user runs; the command does. With --gate, doctor checks only what bugpatrol run needs:

  • leaves out the agent LLM checks (explorer, judge, fixer), gh, and the checks of the app block (connect.url, python3, desktop tools), which only the agent commands use
  • keeps the config, Node, browser and gate checks (pinned image, AppModel, Intent Ledger)
  • fails when the config has no run block, since the gate cannot start the app without one

init --gate now suggests bugpatrol doctor --gate. Doctor also rejects unknown flags now, the way run does, so a mistyped --gtae fails instead of running the full check. Plain bugpatrol doctor behaves as before. The command reference, usage text and the deterministic gate guide document the flag.

Test plan

  • vitest run on doctor.test.ts, doctor-gate.review.test.ts, init.test.ts: new tests cover a gate config with no key passing under --gate (and still failing without it), --gate on a config with no run block failing, a gate config whose app.connect.url is down still passing, and flag parsing
  • biome check --error-on-warnings, tsc -p packages/cli, knip
  • In examples/fixture-app with no OPENROUTER_API_KEY: bugpatrol doctor --gate exits 0; doctor --gtae exits 2 with "Unknown flag"

Closes #199

🤖 Generated with Claude Code

`bugpatrol init --gate` writes a config for the deterministic web gate and
then suggested `bugpatrol doctor`, which failed with exit 2 because it
checked the explorer and judge LLMs, which the gate never calls.

`bugpatrol doctor --gate` now checks only what `bugpatrol run` needs: it
leaves out the agent LLMs and gh, and fails when the config has no run
block. `init --gate` suggests it, and unknown doctor flags are rejected.

Closes #199

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
bugpatrol Ready Ready Preview Nov 16, 2026 4:21pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Bugpatrol review: fixture-app

No problem introduced · tested 957e010 against main a228555

Tested

  • Home (index.html) loads
  • Settings (/settings) loads

Not tested

  • The rest of the change: outside the fixture app

Updated on each push. Tests only what the diff can affect. Does not block the merge.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Bugpatrol review: dashboard

No problem introduced · tested 957e010 against main a228555

Tested

  • Overview dashboard loads
  • Issue detail 'Save button overlaps account text' with fix, diff, attempts

Not tested

  • The rest of the change (doctor --gate, init --gate hint, usage/docs): CLI command logic, not rendered by the dashboard

Updated on each push. Tests only what the diff can affect. Does not block the merge.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 434ad181a3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/src/commands/doctor.ts Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T16:13:35.415395Z 434ad18 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

`doctor --gate` still ran the connect.url and platform checks of the app
block, which only the agent commands use. A config whose agents target
another URL failed the gate check when that URL was down, although
`bugpatrol run` starts and drives run.url only. Under --gate, doctor now
checks the config, Node, Chromium and the gate checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjber

cjber commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Codex review (session codex:01a1e520-2b19-7390-8534-66f218e5d9b5) reported one finding:

  • [P2] doctor.ts: --gate skipped the agent checks but still ran urlCheck, which prefers app.connect.url. A config whose agents target a URL that is down failed doctor --gate with exit 2, although bugpatrol run starts and drives run.url only.

Fixed in 957e010: under --gate, doctor checks the config, Node, Chromium and the gate checks (pinned image, AppModel, Intent Ledger), and leaves out the whole app block (connect URL, python3, desktop tools) as well as the agents. A new test covers a config with an unreachable app.connect.url passing under --gate. Docs and usage text updated to match.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Bugpatrol review: cli

No problem introduced · tested 957e010 against main a228555

Tested

  • doctor --gate on config without run block (fixture): gate check fails, exit 2
  • doctor --gtae: unknown flag rejected, exit 2
  • plain doctor: unchanged (agent LLM, browser, url checks present)
  • init --gate: new 'doctor --gate' next-step message, config written
  • doctor --gate on fresh init --gate config: no agent checks, browser+gate checks only
  • doctor --gate --config : combined flags work, missing config fails
  • doctor --gate with run block and dead app.connect.url: url check omitted as designed
  • CLI --help and doctor --help: show --gate usage

Not tested

  • doctor --gate with Chromium actually installed (the ok path of the browser check): the browser binary is not installed in this sandbox and installing it is out of scope
  • init --gate interactive prompt (without --yes): the change only touches the closing log line, verified with --yes
  • docs pages commands.md and deterministic-gate.md rendering: docs are outside the CLI app per the guide

Updated on each push. Tests only what the diff can affect. Does not block the merge.

@joaquim-verges joaquim-verges added the mergepatrol Queue this PR: Mergepatrol rebases, tests and merges it label Nov 16, 2026 — with Nebula AI Agent
@merge-loop

merge-loop Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Merged as 028357c.

@merge-loop merge-loop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MergeLoop's review approves 957e010: nothing it found holds this PR.

@merge-loop
merge-loop Bot merged commit 028357c into main Nov 16, 2026
12 checks passed
@merge-loop merge-loop Bot removed the mergepatrol Queue this PR: Mergepatrol rebases, tests and merges it label Nov 16, 2026

This branch was successfully deployed

1 active deployment
Preview — 957e0106 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doctor exits 2 on a gate-only config because of model keys the gate never uses

2 participants